// import { Select } from "antd"
import { FC } from "react"

import { SFormItem } from "@/components/common"
import StyleSelect from "@/components/common/styleSelect"
import { useOptions } from "@/hooks/useOptions"
import { useLocale } from "@/locales"

export type BusinessModelSelectorField = {
	businessModel: string
	customOption?: any
}

export const BusinessModelSelector: FC<any> = props => {
	const { rules, disable, labelProps, selectorProps, notBoth, hideAllModel, customOption } = props
	const { formatMessage } = useLocale()
	const options = useOptions({ modal: "businessModel", func: formatMessage, strictlyLabel: false }).map((item: any) => {
		if (item.value !== "0" || !hideAllModel) return item
	})
	if (notBoth) options.shift()
	return (
		<SFormItem
			name="businessModel"
			label={`${formatMessage({ id: "label.member.business_model" })}:`}
			rules={rules}
			{...labelProps}
		>
			<StyleSelect
				placeholder={formatMessage({ id: "label.select_all" })}
				allowClear
				options={customOption ?? options}
				disable={disable}
				{...selectorProps}
			/>
		</SFormItem>
	)
}
